////////////////////////////////////////////////////////////////////////////////
//File:					UglyLog.h
//Author:				Kesitem
//This file is part of UglyProject.
//See UglyProjet.txt for copyright informations.
////////////////////////////////////////////////////////////////////////////////
#ifndef __UGLYLOG_H__
#define __UGLYLOG_H__

#include "UglyCore.h"

namespace Ugly
{

/**
 * \brief Log facility
 *
 * The log is a singleton class which allow to trace event of the engine (and the game).
 * To get a log instance you can use the static function <code>Log::instance()</code>,
 * or use the global <code>gLog</code> object.
 *
 * @see gLog
 */
class Log
{
public:

    /**
     * \brief Get the unique instance of the class.
     *
     * \return Unique instance of the log.
     */
	static Log &instance();

    /**
     * \brief Write a C string.
     *
     * \param  _Str    String to write.
     * \return Log reference.
     */
    virtual Log& operator<< (const char* _Str);

    /**
     * \brief Write a C++ string.
     *
     * \param  _Str    String to write.
     * \return Log reference.
     */
	virtual Log& operator<< (const std::string &_Str);

	/**
	 * \brief Write a glm::i32
     *
     * \param	_Val   Value to write.
     * \return Log reference.
     */
	virtual Log& operator<< (const glm::i32 &_Val);

	/**
	 * \brief Write a glm::u32
     *
     * \param	_Val   Value to write.
     * \return Log reference.
     */
	virtual Log& operator<< (const glm::u32 &_Val);

	/**
	 * \brief Write a glm::u8
     *
     * \param	_Val   Value to write.
     * \return Log reference.
     */
	virtual Log& operator<< (const glm::u8 &_Val);

 	/**
	 * \brief Write a glm::i8
     *
     * \param	_Val   Value to write.
     * \return Log reference.
     */
	virtual Log& operator<< (const glm::i8 &_Val);

 	/**
	 * \brief Write a glm::f32
     *
     * \param	_Val   Value to write.
     * \return Log reference.
     */
	virtual Log& operator<< (const glm::f32 &_Val);

    /**
	 * \brief Write a boolean
     *
     * \param	_Val   Value to write.
     * \return Log reference.
     */
	virtual Log& operator<< (bool _Val);

    /**
     * \brief Write a glm::vec3.
     *
     * \param	_Val   Value to write.
     * \return Log reference.
     */
	virtual Log& operator<< (const glm::vec3 &_Val);

    /**
     * \brief Write a glm::mat3.
     *
     * \param	_Val   Value to write.
     * \return Log reference.
     */
	virtual Log& operator<< (const glm::mat3 &_Val);

protected:

    /**
     * \brief Default constructor.
     */
    Log();

    /**
     * \brief Destructor.
     */
    virtual ~Log();

protected:

	/**
	 * \brief Log stream.
	 */
	std::ofstream mStream;
};

/**
 * \brief Global instance of the log.
 *
 * @see Log.
 */
extern Log &gLog;

}//namespace Ugly

#endif//__UGLYLOG_H__
